<?php
  /*
  Plugin Name: WP flash img show
  Plugin URI: http://xwjie.com/post/wp-flash-img-show.html
  Version: 1.0
  Author: Tojary
  Author URI: http://xwjie.com
  Description: wp flash img show is a FLASH Image Slide plugin for WordPress. You can show your articles , photo,goods,product and other ad. or introduction . Just enjoy it. wp flash img show是一个flash图片幻灯片轮换wordpress插件，你可以利用它展示热门日志、艺术图片、商品、产品。通过改变用户设置，还可以用来做图片广告、宣传标语等等。请发挥创意。

  */
?>
<?php
  /*
	V1.0 Build 2010-08-06 
  */
?>
<?php

// Language 
	$dr_locale = get_locale();
	$dr_mofile = dirname(__FILE__) . "/languages/wp-flash-img-show-$dr_locale.mo";
	load_textdomain('wp-flash-img-show', $dr_mofile);


//第一次使用 The First Time
if(!get_option("wp_flash_img_show_pic_number")){	//如果是第一次使用，把沙发排名数据写入数据库
wp_flash_img_show_set_default_options();
wp_flash_img_show_save_to_xml();
}

function wp_flash_img_show_set_default_options(){

	$thisurl = WP_PLUGIN_URL.'/'.str_replace(basename( __FILE__),"",plugin_basename(__FILE__));
	$default_option_names = array("pic_number"		,"1_url"					,"1_link"				,"1_description"	,"2_url"							,"2_link"				,"2_description"		,"3_url"					,"3_link"				,"3_description"			,"4_url"							,"4_link"				,"4_description");
	$default_value = 		array(	"4"				,$thisurl . "images/01.jpg","http://xwjie.com/"	,"Xwjie Home"		,$thisurl . "images/02.jpg","http://ololi.com/"			,"Tojary ACG Blog"		,$thisurl . "images/03.jpg","http://www.moebeta.com/" 		,"Moe ACG Infomation"		,$thisurl . "images/04.jpg"		,"http://ololi.com/"	,"Tojary ACG Blog");
	$default_option_number = count($default_option_names) - 1;
	for ($i=0; $i<= $default_option_number ; $i++) {	
	$default_itemnames = "wp_flash_img_show_".$default_option_names[$i] ;
	update_option($default_itemnames,$default_value[$i]); 
	}

	$default_option_names = array("width","height","roundcorner","autoplaytime","isheightquality","windowopen","btnsetmargin","btndistance","titlebgcolor","titlebgalpha","titletextcolor","titlefont","titlemoveduration","btnalpha","btntextcolor","btndefaultcolor","btnhovercolor","btnfocuscolor","changimagemode","isshowbtn","isshowtitle","scalemode","transform","isshowabout");
	$default_value = 		array(	"240", "180"  ,	"10",			"3"		,	"true"		,	"_blank","auto 5 5 auto",		"20"	,"0xff6600"	,	"0.75"		,	"0xffffff"	,	"TAHOMA" ,		"1"			, "0.7"		,"0xffffff"		,"0x1B3433"		,"0xff9900"		,"0xff6600"		,"click"		,"true"		,	"true"		,"noBorde"	,"alpha"	,"true");
	$default_option_number = count($default_option_names) - 1;
	for ($i=0; $i<= $default_option_number ; $i++) {	
	$default_itemnames = "wp_flash_img_show_".$default_option_names[$i] ;
	update_option($default_itemnames,$default_value[$i]); 
	}
	
}

if($_POST['update_wp_flash_img_show_default_option']){
wp_flash_img_show_set_default_options();
}
	
//设置	 Setting
function wp_flash_img_show_options(){
	$message='Settings saved . Enjoy it !';
	if($_POST['update_wp_flash_img_show_option']){
//save number	
		$wp_flash_img_show_pic_number_saved = get_option("wp_flash_img_show_pic_number");
		$wp_flash_img_show_pic_number = $_POST['wp_flash_img_show_pic_number_option'];
		if ($wp_flash_img_show_pic_number_saved != $wp_flash_img_show_pic_number)
			if(!update_option("wp_flash_img_show_pic_number",$wp_flash_img_show_pic_number))
				$message='Save failed';

// Save IMG
for ($i=1; $i<= $wp_flash_img_show_pic_number_saved; $i++) {				
 
		$url = "wp_flash_img_show_".$i."_url";
		$url_saved = "wp_flash_img_show_".$i."_url_save";
		$url_option = "wp_flash_img_show_".$i."_url_option";
		$$url_saved = get_option($url);
		$$url = $_POST[$url_option];
		if ($$url_saved != $$url)
			if(!update_option($url,$$url))
				$message='Save failed';

		$link = "wp_flash_img_show_".$i."_link";
		$link_saved = "wp_flash_img_show_".$i."_link_save";
		$link_option = "wp_flash_img_show_".$i."_link_option";
		$$link_saved = get_option($link);
		$$link = $_POST[$link_option];
		if ($$link_saved != $$link)
			if(!update_option($link,$$link))
				$message='Save failed';

		$description = "wp_flash_img_show_".$i."_description";
		$description_saved = "wp_flash_img_show_".$i."_description_save";
		$description_option = "wp_flash_img_show_".$i."_description_option";
		$$description_saved = get_option($description);
		$$description = $_POST[$description_option];
		if ($$description_saved != $$description)
			if(!update_option($description,$$description))
				$message='Save failed';
				
}


//save option
	$option_names = array("width","height","roundcorner","autoplaytime","isheightquality","windowopen","btnsetmargin","btndistance","titlebgcolor","titlebgalpha","titletextcolor","titlefont","titlemoveduration","btnalpha","btntextcolor","btndefaultcolor","btnhovercolor","btnfocuscolor","changimagemode","isshowbtn","isshowtitle","scalemode","transform","isshowabout");
	$option_number = count($option_names) - 1;
for ($i=0; $i<= $option_number ; $i++) {	
		$itemnames = "wp_flash_img_show_".$option_names[$i] ;
		$itemnames_saved = "wp_flash_img_show_".$option_names[$i]."_save";
		$itemnames_option = "wp_flash_img_show_".$option_names[$i]."_option";
		$$itemnames_saved = get_option($itemnames);
		$$itemnames = $_POST[$itemnames_option];
		if ($$itemnames_saved != $$itemnames)
			if(!update_option($itemnames,$$itemnames))
				$message='Save failed';	
			}

	wp_flash_img_show_save_to_xml();	

		if ( $message ==  'Save failed' ){
		echo '<div class="error"><strong><p>'.$message.'</p></strong></div>';
		}
		else {
		echo '<div class="updated"><strong><p>'.$message.'</p></strong></div>';
		};
		
	}
?>
<div class=wrap>
	<form method="post" action="">
		<h2>WP flash img show Setting</h2>
		<fieldset name="wp_basic_options"  class="options">
<br />
		<table>
			<tr>
                <td valign="top" align="right"><?php _e('Img item number','wp-flash-img-show'); ?>:</td>
				<td><input type="text" name="wp_flash_img_show_pic_number_option" value="<?php echo get_option("wp_flash_img_show_pic_number");  ?>" /> </td>
		</tr>
</table>	
<table>
<tr>
<td align="center">No.</td>
<td align="center"><?php _e('Photo URL','wp-flash-img-show'); ?></td>
<td align="center"><?php _e('Link','wp-flash-img-show'); ?></td>
<td align="center"><?php _e('description','wp-flash-img-show'); ?></td>
</tr>
<?php
for ($i=1; $i<= get_option("wp_flash_img_show_pic_number"); $i++) {
		$url = "wp_flash_img_show_".$i."_url";
		$link = "wp_flash_img_show_".$i."_link";
		$description = "wp_flash_img_show_".$i."_description";
?>
<tr><td><?php echo $i ?></td>
<td><input type="text" name="wp_flash_img_show_<?php echo $i ?>_url_option" value="<?php echo get_option($url);  ?>" /> </td>
<td><input type="text" name="wp_flash_img_show_<?php echo $i ?>_link_option" value="<?php echo get_option($link);  ?>" /> </td>
<td><input type="text" name="wp_flash_img_show_<?php echo $i ?>_description_option" value="<?php echo get_option($description);  ?>" /> </td>
</tr>
<?php
}
?>	
</table>
<br />
<div style=" ">
<b><?php _e('Tips:Put this code in your template','wp-flash-img-show'); ?>.</b>
<br />
<?php highlight_string("<?php if (function_exists('wp_flash_img_show')) {wp_flash_img_show();} ?>") ?>
</div>
 


<h3><?php _e('Display option','wp-flash-img-show'); ?></h3>
			<table>
<tr>
<td><?php _e('Width','wp-flash-img-show'); ?></td>
<td><input type="text" name="wp_flash_img_show_width_option" value="<?php echo get_option("wp_flash_img_show_width");  ?>" /></td>
<td>(px) &nbsp;<?php _e('default','wp-flash-img-show'); ?>: 240 </td>
</tr>
<tr>
<td><?php _e('Height','wp-flash-img-show'); ?></td>
<td><input type="text" name="wp_flash_img_show_height_option" value="<?php echo get_option("wp_flash_img_show_height");  ?>" /></td>
<td>(px) &nbsp;<?php _e('default','wp-flash-img-show'); ?>: 180 </td>
</tr>

<tr>
<td><?php _e('Round Corner','wp-flash-img-show'); ?></td>
<td><input type="text" name="wp_flash_img_show_roundcorner_option" value="<?php echo get_option("wp_flash_img_show_roundcorner");  ?>" /></td>
<td> &nbsp;<?php _e('default','wp-flash-img-show'); ?>: 10 </td>
</tr>		
<tr>
<td><?php _e('Auto Play Time','wp-flash-img-show'); ?></td>
<td><input type="text" name="wp_flash_img_show_autoplaytime_option" value="<?php echo get_option("wp_flash_img_show_autoplaytime");  ?>" /></td>
<td>(s) &nbsp;<?php _e('default','wp-flash-img-show'); ?>: 3</td>
</tr>
<tr>
<td><?php _e('Is Height Quality','wp-flash-img-show'); ?></td>
<td> 
<input type="radio" name="wp_flash_img_show_isheightquality_option" value="true" <?php if( get_option("wp_flash_img_show_isheightquality") == 'true' ) echo "checked" ; ?> >True
 | <input type="radio" name="wp_flash_img_show_isheightquality_option" value="false" <?php if( get_option("wp_flash_img_show_isheightquality") == 'false' ) echo "checked" ; ?> >False
</td>
<td> &nbsp;<?php _e('default','wp-flash-img-show'); ?>: True</td>
</tr>
<!--
<tr>
<td>Normal</td>
<td><input type="text" name="wp_flash_img_show_normal_option" value="<?php echo get_option("wp_flash_img_show_normal");  ?>" /></td>
<td> &nbsp; </td>
</tr>
-->
<tr>
<td><?php _e('Window Open','wp-flash-img-show'); ?></td>
<td>
<input type="radio" name="wp_flash_img_show_windowopen_option" value="_blank" <?php if( get_option("wp_flash_img_show_windowopen") == '_blank' ) echo "checked" ; ?> >_blank 
 | <input type="radio" name="wp_flash_img_show_windowopen_option" value="_self" <?php if( get_option("wp_flash_img_show_windowopen") == '_self' ) echo "checked" ; ?> >_self
</td>
<td> &nbsp;<?php _e('default','wp-flash-img-show'); ?>: _blank</td>
</tr>
<tr>
<td><?php _e('Btn Set Margin','wp-flash-img-show'); ?></td>
<td><input type="text" name="wp_flash_img_show_btnsetmargin_option" value="<?php echo get_option("wp_flash_img_show_btnsetmargin");  ?>" /></td>
<td> &nbsp;<?php _e('default','wp-flash-img-show'); ?>: auto 5 5 auto</td>
</tr>
<tr>
<td><?php _e('Btn Distance','wp-flash-img-show'); ?></td>
<td><input type="text" name="wp_flash_img_show_btndistance_option" value="<?php echo get_option("wp_flash_img_show_btndistance");  ?>" /></td>
<td> &nbsp;<?php _e('default','wp-flash-img-show'); ?>: 20 </td>
</tr>	
<tr>
<td><?php _e('Description Bg Color','wp-flash-img-show'); ?></td>
<td><input type="text" name="wp_flash_img_show_titlebgcolor_option" value="<?php echo get_option("wp_flash_img_show_titlebgcolor");  ?>" /></td>
<td> &nbsp;<?php _e('default','wp-flash-img-show'); ?>: 0xff6600</td>
</tr>
<tr>	
<td><?php _e('Description Bg Alpha','wp-flash-img-show'); ?></td>
<td><input type="text" name="wp_flash_img_show_titlebgalpha_option" value="<?php echo get_option("wp_flash_img_show_titlebgalpha");  ?>" /></td>
<td> &nbsp;<?php _e('default','wp-flash-img-show'); ?>: 0.75 </td>
</tr>
<tr>
<td><?php _e('Description Text Color','wp-flash-img-show'); ?></td>
<td><input type="text" name="wp_flash_img_show_titletextcolor_option" value="<?php echo get_option("wp_flash_img_show_titletextcolor");  ?>" /></td>
<td> &nbsp;<?php _e('default','wp-flash-img-show'); ?>:  0xffffff</td>
</tr>
<tr>	
<td><?php _e('Description Text Font','wp-flash-img-show'); ?></td>
<td><input type="text" name="wp_flash_img_show_titlefont_option" value="<?php echo get_option("wp_flash_img_show_titlefont");  ?>" /></td>
<td> &nbsp;<?php _e('default','wp-flash-img-show'); ?>: TAHOMA</td>
</tr>
<tr>	
<td><?php _e('Description Move Duration','wp-flash-img-show'); ?></td>
<td><input type="text" name="wp_flash_img_show_titlemoveduration_option" value="<?php echo get_option("wp_flash_img_show_titlemoveduration");  ?>" /></td>
<td> (s)&nbsp;<?php _e('default','wp-flash-img-show'); ?>: 1 </td>
</tr>
<tr>	
<td><?php _e('Btn Alpha','wp-flash-img-show'); ?></td>
<td><input type="text" name="wp_flash_img_show_btnalpha_option" value="<?php echo get_option("wp_flash_img_show_btnalpha");  ?>" /></td>
<td> &nbsp;<?php _e('default','wp-flash-img-show'); ?>: 0.7 </td>
</tr>	
<tr>
<td><?php _e('Btn Text Color','wp-flash-img-show'); ?> </td>
<td><input type="text" name="wp_flash_img_show_btntextcolor_option" value="<?php echo get_option("wp_flash_img_show_btntextcolor");  ?>" /></td>
<td> &nbsp;<?php _e('default','wp-flash-img-show'); ?>: 0xffffff </td>
</tr>	
<tr>	
<td><?php _e('Btn Default Color','wp-flash-img-show'); ?> </td>
<td><input type="text" name="wp_flash_img_show_btndefaultcolor_option" value="<?php echo get_option("wp_flash_img_show_btndefaultcolor");  ?>" /></td>
<td> &nbsp;<?php _e('default','wp-flash-img-show'); ?>: 0x1B3433 </td>
</tr>	
<tr>
<td> <?php _e('Btn Hover Color','wp-flash-img-show'); ?> </td>
<td><input type="text" name="wp_flash_img_show_btnhovercolor_option" value="<?php echo get_option("wp_flash_img_show_btnhovercolor");  ?>" /></td>
<td> &nbsp;<?php _e('default','wp-flash-img-show'); ?>: 0xff9900 </td>
</tr>	
<tr>	
<td> <?php _e('Btn Focus Color','wp-flash-img-show'); ?> </td>
<td><input type="text" name="wp_flash_img_show_btnfocuscolor_option" value="<?php echo get_option("wp_flash_img_show_btnfocuscolor");  ?>" /></td>
<td> &nbsp;<?php _e('default','wp-flash-img-show'); ?>: 0xff6600 </td>
</tr>	
<tr>
<td> <?php _e('Chang Image Mode','wp-flash-img-show'); ?> </td>
<td>
<input type="radio" name="wp_flash_img_show_changimagemode_option" value="click" <?php if( get_option("wp_flash_img_show_changimagemode") == 'click' ) echo "checked" ; ?> >click 
 | <input type="radio" name="wp_flash_img_show_changimagemode_option" value="hover" <?php if( get_option("wp_flash_img_show_changimagemode") == 'hover' ) echo "checked" ; ?> >hover
</td>
<td> &nbsp;<?php _e('default','wp-flash-img-show'); ?>: click </td>
</tr>	
<tr>	
<td> <?php _e('Is Show Btn','wp-flash-img-show'); ?> </td>
<td>
<input type="radio" name="wp_flash_img_show_isshowbtn_option" value="true" <?php if( get_option("wp_flash_img_show_isshowbtn") == 'true' ) echo "checked" ; ?> >True
 | <input type="radio" name="wp_flash_img_show_isshowbtn_option" value="false" <?php if( get_option("wp_flash_img_show_isshowbtn") == 'false' ) echo "checked" ; ?> >False
</td>
<td> &nbsp;<?php _e('default','wp-flash-img-show'); ?>: true </td>
</tr>	
<tr>
<td> <?php _e('Is Show Description','wp-flash-img-show'); ?> </td>
<td> 
<input type="radio" name="wp_flash_img_show_isshowtitle_option" value="true" <?php if( get_option("wp_flash_img_show_isshowtitle") == 'true' ) echo "checked" ; ?> >True
 | <input type="radio" name="wp_flash_img_show_isshowtitle_option" value="false" <?php if( get_option("wp_flash_img_show_isshowtitle") == 'false' ) echo "checked" ; ?> >False
</td>
<td> &nbsp;<?php _e('default','wp-flash-img-show'); ?>: true </td>
</tr>	
<tr>
<td> <?php _e('Scale Mode','wp-flash-img-show'); ?> </td>
<td>
<select  name="wp_flash_img_show_scalemode_option" >
<option value="noBorder" <?php  if ( get_option("wp_flash_img_show_scalemode")   == "noBorder" ) echo "selected";  ?> >noBorder</option>
<option value="showAll" <?php if ( get_option("wp_flash_img_show_scalemode")  == "showAll" ) echo "selected";  ?> >showAll</option>
<option value="exactFil" <?php if ( get_option("wp_flash_img_show_scalemode")   == "exactFil" ) echo "selected";  ?> >exactFil</option>
<option value="noScale" <?php if ( get_option("wp_flash_img_show_scalemode")   == "noScale" ) echo "selected";  ?> >noScale</option>
</select>
</td>
<td> &nbsp;<?php _e('default','wp-flash-img-show'); ?>: noBorde </td>
</tr>	
<tr>
<td> <?php _e('Transform','wp-flash-img-show'); ?> </td>
<td>
<select  name="wp_flash_img_show_transform_option" >
<option value="alpha" <?php  if ( get_option("wp_flash_img_show_transform")   == "alpha" ) echo "selected";  ?> >alpha</option>
<option value="blur" <?php if ( get_option("wp_flash_img_show_transform")  == "blur" ) echo "selected";  ?> >blur</option>
<option value="left" <?php if ( get_option("wp_flash_img_show_transform")   == "left" ) echo "selected";  ?> >left</option>
<option value="right" <?php if ( get_option("wp_flash_img_show_transform")   == "right" ) echo "selected";  ?> >right</option>
<option value="top" <?php if ( get_option("wp_flash_img_show_transform")  == "top" ) echo "selected";  ?> >top</option>
<option value="bottom" <?php if ( get_option("wp_flash_img_show_transform") == "bottom" ) echo "selected";  ?> >bottom</option>
<option value="breathe" <?php if ( get_option("wp_flash_img_show_transform")  == "breathe" ) echo "selected";  ?> >breathe</option>
<option value="breatheBlur" <?php if ( get_option("wp_flash_img_show_transform") == "breatheBlur" )  echo "selected";  ?> >breatheBlur</option>
</select>
</td>
<td> &nbsp;<?php _e('default','wp-flash-img-show'); ?>:  alpha</td>
</tr>
<tr>
<td> <?php _e('Is Show About','wp-flash-img-show'); ?> </td>
<td>
<input type="radio" name="wp_flash_img_show_isshowabout_option" value="true" <?php if( get_option("wp_flash_img_show_isshowabout") == 'true' ) echo "checked" ; ?> >True
 | <input type="radio" name="wp_flash_img_show_isshowabout_option" value="false" <?php if( get_option("wp_flash_img_show_isshowabout") == 'false' ) echo "checked" ; ?> >False
</td>
<td> &nbsp;<?php _e('default','wp-flash-img-show'); ?>: True  </td>
</tr>

			</table>
			
		</fieldset>
		<p class="submit">
		<input  class="button-primary" type="submit" name="update_wp_flash_img_show_option" value="<?php _e('Update Options','wp-flash-img-show'); ?>" />
	</form>

<form method="post" action="">
		<input  type="submit" name="update_wp_flash_img_show_default_option" value="<?php _e('Default option','wp-flash-img-show'); ?>" onclick="return checkup()"  />
<script language="javascript">
function checkup()
{
  if(window.confirm("<?php _e('Load Defaults Setting! Are You Sure ?','wp-flash-img-show'); ?>"))
  {
   return true;
  }
  else
  {
    return false;
  }
}
</script>
	</p>
</form>	

<div>

<?php _e('If you find my work useful and you want to encourage the development of more free resources, you can do it by donating...','wp-flash-img-show'); ?> 
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="on0" value="Choose">
<table>
<tr><td> paypal:
<select name="os0">
	<option value="2 USD">2 USD $2.00</option>
	<option value="5 USD">5 USD $5.00</option>
	<option value="10 USD">10 USD $10.00</option>
</select> </td><td>&nbsp;
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="encrypted" value="-----BEGIN PKCS7-----MIIIAQYJKoZIhvcNAQcEoIIH8jCCB+4CAQExggEwMIIBLAIBADCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQ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SqGSIb3DQEJARYNcmVAcGF5cGFsLmNvbQIBADAJBgUrDgMCGgUAoF0wGAYJKoZIhvcNAQkDMQsGCSqGSIb3DQEHATAcBgkqhkiG9w0BCQUxDxcNMTAwODA2MTUxNDU2WjAjBgkqhkiG9w0BCQQxFgQU1IRsxmmoCysVCdqCFEK/F2i61KMwDQYJKoZIhvcNAQEBBQAEgYCJ0hpYkQ4OCHZcbyez8XMzam1JnY8dJh9ldEl+GV/EIqn3qN+1LZmle/9eWIGQQr9+RhqeUZ9ldCDEtFKlygOC7rVS5MoMihF9DkDEUjwobb7TBy/JkD7pkyg8v+R9UM1LRCijmdKi91wlnUy0fbv3/QjR2dz5fyVjYIC3r4mPJw==-----END PKCS7-----
">
<input type="image" src="http://file.xwjie.com/en-btn_donate_LG.gif" border="0" name="submit" alt="PayPal——最安全便捷的在线支付方式！">
<img alt="" border="0" src="https://www.paypal.com/zh_XC/i/scr/pixel.gif" width="1" height="1">
</form>
</td>

<td>
</td>
<td>
</td>

</tr>
</table>

</div>

</div>
<?php
}

function wp_flash_img_show_options_admin(){
	add_options_page('wp_flash_img_show', 'WP flash img show', 5,  __FILE__, 'wp_flash_img_show_options');
}

add_action('admin_menu', 'wp_flash_img_show_options_admin');
 
 
function wp_flash_img_show_header(){
	$thisurl = WP_PLUGIN_URL.'/'.str_replace(basename( __FILE__),"",plugin_basename(__FILE__));
	echo '<script src="'. $thisurl  .'swfobject.js" type="text/javascript"></script>' ;
	echo "\n" ;
 }
add_action('wp_head', 'wp_flash_img_show_header');
 
function wp_flash_img_show(){
	$thisurl = WP_PLUGIN_URL.'/'.str_replace(basename( __FILE__),"",plugin_basename(__FILE__));
?>
<div id="wp_flash_img_show_box" style="width:<?php echo get_option("wp_flash_img_show_width");  ?>px;height:<?php echo get_option("wp_flash_img_show_height");  ?>px;">
<div id="wp_flash_img_show">This movie requires Flash Player 9</div> 
<script type="text/javascript"> 
	swfobject.embedSWF("<?php echo $thisurl ?>wp-flash-img-show.swf", "wp_flash_img_show", "<?php echo get_option("wp_flash_img_show_width");  ?>", "<?php echo get_option("wp_flash_img_show_height");  ?>", "9", "", {xml: "<?php echo $thisurl ?>wp-flash-img-show.xml"}, {wmode: "window", menu: "true", quality: "high", bgcolor: "null", allowFullScreen: "true"}, {});
</script> 
</div>
<?php
}

function wp_flash_img_show_save_to_xml() {
/*
  $data = array();
  $data [] = array(
  'title' => 'PHP Hacks',
  'author' => 'Jack Herrington',
  'publisher' => "O'Reilly"
  );
  $data [] = array(
  'title' => 'Podcasting Hacks',
  'author' => 'Jack Herrington',
  'publisher' => "O'Reilly"
  );
  */
  $doc = new DOMDocument();
  $doc->formatOutput = true;
  
  $r = $doc->createElement( "data" );
  $doc->appendChild( $r );
  

  $_channel =  $doc->createElement( "channel" ); //  channel star  , img list star

for ($i=1; $i<= get_option("wp_flash_img_show_pic_number"); $i++) {

	$url = "wp_flash_img_show_".$i."_url";
	$link = "wp_flash_img_show_".$i."_link";
	$description = "wp_flash_img_show_".$i."_description";
		
//item
  $_item = $doc->createElement( "item" );
  //list star
  $_link = $doc->createElement( "link" );
  $_link->appendChild( $doc->createTextNode( get_option($link) ) );
  $_item->appendChild( $_link );
  
  $_image = $doc->createElement( "image" );
  $_image->appendChild(  $doc->createTextNode( get_option($url) ) );
  $_item->appendChild( $_image );
  
  $_title = $doc->createElement( "title" );
  $_title->appendChild( $doc->createTextNode( get_option($description) ) );
  $_item->appendChild( $_title ); 
  //list end
  $_channel->appendChild( $_item );
}

  $r->appendChild( $_channel ); //  channel end All img listed
  
// Config star  
 $_config =  $doc->createElement( "config" );
 
 $option_true_names = 	array("roundCorner","autoPlayTime","isHeightQuality","windowOpen","btnSetMargin","btnDistance","titleBgColor","titleBgAlpha","titleTextColor","titleFont","titleMoveDuration","btnAlpha","btnTextColor","btnDefaultColor","btnHoverColor","btnFocusColor","changImageMode","isShowBtn","isShowTitle","scaleMode","transform","isShowAbout");
 $option_names = 		array("roundcorner","autoplaytime","isheightquality","windowopen","btnsetmargin","btndistance","titlebgcolor","titlebgalpha","titletextcolor","titlefont","titlemoveduration","btnalpha","btntextcolor","btndefaultcolor","btnhovercolor","btnfocuscolor","changimagemode","isshowbtn","isshowtitle","scalemode","transform","isshowabout");

 $option_number = count($option_names) - 1;
 for ($i=0; $i<= $option_number ; $i++) {
//config item  
 $itemnames = "wp_flash_img_show_".$option_names[$i] ;
 $item_true_names = "wp_flash_img_show_".$option_true_names[$i] ;
 $$itemnames = $doc->createElement( $option_true_names[$i] );
 $$itemnames->appendChild( $doc->createTextNode( get_option($itemnames) ) );
 $_config->appendChild( $$itemnames ); 
}
 
 $r->appendChild( $_config ); // Config End   

	$filename = dirname(__FILE__) . "/wp-flash-img-show.xml" ;
    $doc->save($filename);
 
}
?>